import qs from "qs";

export function paramsSerializer(params) {
  if (params == null) {
    return '';
  }
  params = Object.keys(params).reduce((prev, key) => {
    const value = params[key];
    if (value != null && value !== '') {
      prev[key] = value;
    }
    return prev;
  }, {});
  return qs.stringify(params, {
    indices: false,
    allowDots: true,
    skipNulls: true
  });
}